Muhammad Haris Rao
We turn to the problem of finding an explicit formula for \begin{align*} S_n(N) := \sum_{k = 1}^N k^n = 1^n + 2^n + 3^n + \cdots + (N - 1)^n + N^n \end{align*} for any given $n \in \mathbb{Z}_{\ge 0}$. Clearly, $S_n(N) \le N^{n + 1}$, which means \begin{align*} \sum_{n = 0}^\infty \left| \frac{S_n(N) z^n}{n!} \right| \le \sum_{n = 0}^\infty \frac{N \cdot N^n |z|^n}{n!} = N \sum_{n = 0}^\infty \frac{ \left( N|z| \right)^n }{n!} \end{align*} which converges to $Ne^{N|z|}$. So the generating function of the values of $\{ S_n (N) \}_{n \ge 0}$ converges to an analytic function on all of $\mathbb{C}$. The generating function is \begin{align*} \sum_{n = 0}^\infty \frac{\left( 1^n + 2^n + \cdots + N^n \right) z^n }{n!} &= \sum_{n = 0}^\infty \frac{\left( 1 z \right)^n}{n!} + \sum_{n = 0}^\infty \frac{\left( 2 z \right)^n}{n!} + \cdots + \sum_{n = 0}^\infty \frac{\left( N z \right)^n}{n!} \\ &= e^z + e^{2z} + \cdots + e^{Nz} \\ &= e^z \left( \frac{1 - e^{Nz}}{1 - e^z} \right) \\ z \sum_{n = 0}^\infty \frac{S_n(N) z^n}{n!} &= \frac{z e^{(N + 1)z}}{e^z - 1} - \frac{z e^z}{e^z - 1} \\ &= \frac{z e^{Nz}}{1 - e^{-z}} - \frac{z}{1 - e^{-z}} \end{align*} Thus, the values of the sums over $n$th powers are directly related to the Taylor series of $z e^{xz} / (1-e^{-z})$ for non-negative integer values of $x$. This motivates the following definition:
Definition: For $n \in \mathbb{Z}_{\ge 0}$, the Bernoulli polynomial $B_n(x)$ is defined by \begin{align*} \frac{z e^{xz}}{1 - e^{-z}} &= \sum_{n = 0}^\infty \frac{B_n(x) z^n}{n!} \end{align*} The Bernoulli numbers are $B_n = B_n(0)$.
Remark: There is a difference of convention here. Most authors define the Bernoulli polynomials to be generated by \begin{align*} \frac{z e^{xz}}{e^z - 1} &= \frac{z e^{(x - 1)z}}{1 - e^{-z}} \end{align*} So their Bernoulli polynomials are shifted by 1 to the right. They only differ by a sign in the coefficient of the second highest term. We will continue with our convention as it is more convenient for the purposes of writing down the polynomials which give the sums over the $n$th powers. Later, when we study the Euler-Maclaurin summation formula, we will switch conventions.
By equating the terms in the two power series \begin{align*} z \sum_{n = 0}^\infty \frac{\left( 1^n + 2^n + \cdots + N^n \right) z^n }{n!} &= \frac{z e^{Nz}}{1 - e^{-z}} - \frac{z}{1 - e^{-z}} = \sum_{n = 0}^\infty \frac{ \left( B_n(N) - B_n \right) z^n}{n!} \end{align*} We have now \begin{align*} 1^n + 2^n + 3^n + \cdots + N^n &= \frac{1}{n + 1} \left( B_{n + 1} \left( N \right) - B_{n + 1} \right) \end{align*} It is not obvious that the $B_n(x)$ are indeed polynomials, so we will show this first.
Lemma: For $n \in \mathbb{Z}_{\ge 0}$, the function $B_n(x)$ is a polynomial. Explicitly, \begin{align*} B_n(x) &= \sum_{k = 0}^n { n \choose k } B_{n - k} x^k \end{align*}
Proof. We have \begin{align*} \frac{z e^{xz}}{e^z - 1} &= \frac{z}{e^z - 1} \sum_{n = 0}^\infty \frac{(xz)^n}{n!} \\ &= \left( \sum_{n = 0}^\infty \frac{B_n z^n}{n!} \right) \left( \sum_{n = 0}^\infty \frac{(xz)^n}{n!} \right) \end{align*} Since both power series converge absolutely in a neighborhood of $0$, we can multiply by the usual convolution: \begin{align*} \left( \sum_{n = 0}^\infty \frac{B_n z^n}{n!} \right) \left( \sum_{n = 0}^\infty \frac{(xz)^n}{n!} \right) &= \sum_{n = 0}^\infty \sum_{k = 0}^n \left( \frac{B_{n - k}x^k}{k!(n - k)!} \right) z^n \\ &= \sum_{n = 0}^\infty \frac{1}{n!} \left[ \sum_{k = 0}^n { n \choose k } B_{n - k} x^k \right] z^n \end{align*} Which is the desired equality.
Since the Bernoulli numbers can be readily computed by \begin{align*} B_n &= \left[ \frac{d}{dz} \frac{z}{1 - e^{-z}} \right]_{z = 0} \end{align*} we have a computable formula: \begin{align*} 1^n + 2^n + \cdots + N^n &= \frac{1}{n + 1} \sum_{k = 1}^{n + 1} { n + 1\choose k } B_{n + 1 - k} N^k \end{align*} We will now work on simplifying this form, and also finding a method to compute the Bernoulli numbers recursively without depending on the analytic properties of its generating function. Our first step is the following:
Lemma: Except for $B_1 = 1/2$, all the odd Bernoulli numbers are 0.
Set \begin{align*} f(z) &= \frac{z}{1 - e^{-z}} - \frac{z}{2} \end{align*} Then we have \begin{align*} f(-z) &= -\frac{z}{1 - e^z} + \frac{z}{2} = \frac{ z e^{-z}}{1 - e^{-z}} + \frac{z}{2} = \frac{2 z e^{-z} + z \left( 1 - e^{-z} \right) }{2 \left( 1 - e^{-z} \right)} = \frac{2z + z \left( e^{-z} - 1 \right) }{2 \left( 1 - e^{-z} \right)} = \frac{z}{ 1 - e^{-z}} - \frac{z}{2} = f(z) \end{align*} Which means that $f$ is an even function, so its Taylor expansion around 0 must have only even terms. This is \begin{align*} f(z) = B_0 + \left( B_1 - \frac{1}{2} \right) z + \frac{B_2 z^2}{2!} + \frac{B_3 z^3}{3!} + \frac{B_4 z^4}{4!} + \frac{B_5 z^5}{5!} + \cdots \end{align*} So we have $B_1 = 1/2$ and $B_{2n + 1} = 0$ for all $n \ge 1$.
Theorem: We have the following recurion for the Bernoulli numbers: \begin{align*} B_n = 1 - \sum_{k = 0}^{n - 1} { n \choose k } \frac{B_k}{n - k + 1} \end{align*}
Proof. Recall that \begin{align*} 1^n + 2^n + \cdots + N^n &= \frac{1}{n + 1} \sum_{k = 1}^{n + 1} { n + 1\choose k } B_{n + 1 - k} N^k \end{align*} Taking $N = 1$, we have \begin{align*} 1 &= \frac{1}{n + 1} \sum_{k = 1}^{n + 1} { n + 1\choose k } B_{n + 1 - k} \\ B_n &= 1 - \frac{1}{n + 1} \sum_{k = 2}^{n + 1} { n + 1\choose k } B_{n + 1 - k} \\ &= 1 - \frac{1}{n + 1} \sum_{k = 0}^{n - 1} { n + 1\choose k } B_k \\ &= 1 - \sum_{k = 0}^{n - 1} { n \choose k } \frac{B_k}{n - k + 1} \\ \end{align*}
Theorem: We have the following recurrence relation for the Bernoulli polynomials: \begin{align*} B_n(x) &= B_n + \int_0^x B_{n - 1} \left( t \right) \, dt \end{align*}
This is a direct calculation: \begin{align*} \frac{d}{dx} B_n(x) &= \frac{d}{dx} \sum_{k = 0}^n { n \choose k } B_{n - k} x^k \\ &= \sum_{k = 1}^n \frac{n!}{(k - 1)! (n - k)!} B_{n - k} x^{k - 1} \\ &= n \sum_{k = 0}^{n - 1} \frac{(n - 1)!}{k! ((n - 1)- k)!} B_{(n - 1) - k} x^k \\ &= n \sum_{k = 0}^{n - 1} { n - 1 \choose k } B_{(n - 1) - k} x^k \\ &= n B_{n - 1}(x) \end{align*} Integrating and using the fact that $B_n(0) = B_n$, we have \begin{align*} B_n(x) &= B_n + n \int_0^x B_{n - 1} (t) \, dt \end{align*}
So now we have a recursive method of computing the Bernoulli polynomials and numbers so that we can in doing so compute the polynomial which gives the sum over $k^n$ from $k = 1$ to $k = N$ \begin{align*} 1^n + 2^n + \cdots + N^n &= \frac{1}{n + 1} \sum_{k = 1}^{n + 1} { n + 1\choose k } B_{n + 1 - k} N^k = \frac{B_{n + 1}(N) - B_{n + 1}}{n + 1} \end{align*} See that the right hand side is just the $(n + 1)$th Bernolli polynomial without the constant term divided through by $n + 1$.
The first several Bernoulli numbers are \begin{align*} B_0 &= 1 & B_1 &= \frac{1}{2} & B_2 &= \frac{1}{6} & B_3 &= 0 & B_4 &= - \frac{1}{30} \\ B_5 &= 0 & B_6 &= \frac{1}{42} & B_7 &= 0 & B_8 &= - \frac{1}{30} & B_9 &= 0 \\ B_{10} &= \frac{5}{66} & B_{11} &= 0 & B_{12} &= - \frac{691}{2730} & B_{13} &= 0 & B_{14} &= \frac{7}{6} \\ B_{15} &= 0 & B_{16} &= - \frac{3617}{510} & B_{17} &= 0 & B_{18} &= \frac{43867}{798} & B_{19} &= 0 \\ B_{20} &= - \frac{174611}{330} & B_{21} &= 0 & B_{22} &= \frac{854513}{138} & B_{23} &= 0 & B_{24} &= - \frac{236364091}{2730} \end{align*} And the first several Bernoulli polynomials with the slight alteration to give the sum over $n$th powers are
And just for fun, the sum over $100$th powers is
Now, we will change some conventions. The Bernoulli polynomials and numbers so far studied will be denoted $B_n^+(x)$ and $B_n^+$, for reasons that will be clear soon. Define $B_n^-(x)$ by the rule \begin{align*} B_n^-(x) = B_n^+(x - 1) \end{align*} This would mean that \begin{align*} \frac{ z e^{xz}}{e^z - 1} = \frac{z e^{(x - 1)z}}{1 - e^{-z}} = \sum_{n = 0}^\infty \frac{B_n^+(x - 1) z^n}{n!} = \sum_{n = 0}^\infty \frac{B_n^-(x) z^n}{n!} \end{align*} For $n \ge 1$, also have the identity \begin{align*} 1^{n - 1} + 2^{n - 1} + \cdots + (N - 1)^{n - 1} &= \frac{1}{n} \left( B_n^+(N - 1) - B_n^+ \right) \end{align*} which implies \begin{align*} B_n^-(N) = B_n^+(N - 1) &= n \left( 1^{n - 1} + 2^{n - 1} + \cdots + N^{n - 1} - N^{n - 1} \right) + B_n^+ = n \left( \frac{1}{n} \left( B_n^+(N) - B_n^+ \right) - N^{n - 1} \right) + B_n^+ \\ &= B_n^+(N) - n N^{n - 1} \end{align*} This holds for all positive integers $N \in \mathbb{Z}_{>0}$, so must hold for all $x \in \mathbb{C}$ since polynomials are completely determined by their values on a countable set. That is, we have \begin{align*} B_n^-(x) &= B_n^+(x) - n x^{n - 1} \end{align*} An explicit expression for $B_n^+(x)$ was \begin{align*} B_n^+(x) &= \sum_{k = 0}^n { n \choose k } B_{n - k}^+ x^k \end{align*} The $x^{n - 1}$ term has a coefficient of $n/2$, so when we subtract $n x^{n - 1}$ from $B_n^+(x)$ to get $B_n^-(x)$, the $x^{n - 1}$ term switches sign, and everything else stays the same. Then for $n \ge 1$, \begin{align*} B_n^- := B_n^-(0) = \left[ B_n^+(x) - n x^{n - 1} \right]_{x = 0} = \begin{cases} B_n^+ &\text{ , if $n > 1$} \\ -\frac{1}{2} &\text{ , if $n = 1$} \end{cases} \end{align*} When $n = 0$, we still have $B_0^-(x) = 1$, so $B_0^- = B_0^+ = 1$.
For the derivation of the Euler-Maclaurin summtion formula, we will make use of the following property of $B_n^-(x)$:
Theorem: For all $n \ge 1$, \begin{align*} \int_0^1 B_n^-(t) \, dt = 0 \end{align*}
Proof. The formula for the sums over the $n$th powers yields \begin{align*} 1 &= \frac{1}{n + 1} \left( B_{n + 1}^+(1) - B_{n + 1}^+ \right) = \frac{1}{n + 1} \left( B_{n + 1}^+ + (n + 1) \int_0^1 B_n^+(t) \, dt - B_{n + 1}^+ \right) = \int_0^1 B_n^+ (t) \, dt \end{align*} Then, for $n \ge 1$ we can use the relationship between the positive and negative Bernoulli polynomials to get \begin{align*} \int_0^1 B_n^-(t) \, dt &= \int_0^1 B_n^+(x) - n x^{n - 1} \, dt = 1 - \left[ x^n \right]_0^1 = 0 \end{align*}
This implies that \begin{align*} \int_n^m B_n^-\left( \{ t \} \right) \, dt = 0 \end{align*} for all $n, m \in \mathbb{Z}$, and where $\{ \cdot \} : \mathbb{R} \longrightarrow \mathbb{Z}$ maps reals to their fractional parts (i.e. $\{ x \} = x = \lfloor x \rfloor$).
Recall the Euler summation formula: \begin{align*} \sum_{a < k \le b} f(k) &= \int_a^b f(t) \, dt + \int_a^b \{ t \} f^\prime(t) \, dt \end{align*} where $f : \mathbb{R}_{> 0} \longrightarrow \mathbb{C}$ is continuously differentiable. Recalling that $B_1^-(x) = x - 1/2$, we have then \begin{align*} \sum_{a < k \le b} f(k) &= \int_a^b f(t) \, dt + \int_a^b \left( \{ t \} - \frac{1}{2} \right) f^\prime(t) \, dt + \frac{1}{2} \left( f(b) - f(a) \right) \\ &= \int_a^b f(t) \, dt + \int_a^b B_1^-\left( \{ t \} \right) f^\prime(t) \, dt + \frac{1}{2} \left( f(b) - f(a) \right) \end{align*} Next, integration by parts gives \begin{align*} \int_k^{k + 1} B_n^- \left( \{ t \} \right) f^{(n)} (t) \, dt &= \frac{1}{n} \left( B_{n + 1}^- (1) f^{(n)} \left(k + 1\right) - B_{n + 1}^- (0) f^{(n)} \left( k \right) \right) - \frac{1}{n} \int_k^{k + 1} B_{n + 1}^- \left( \{ t \} \right) f^{(n + 1)} (t) \, dt \\ &= - \frac{B_{n + 1}^-}{n} \left( f^{(n)} \left(k + 1\right) - f^{(n)} \left( k \right) \right) - \frac{1}{n} \int_k^{k + 1} B_{n + 1}^- \left( \{ t \} \right) f^{(n + 1)} (t) \, dt \\ \int_a^b B_n^- \left( \{ t \} \right) f^{(n)} (t) \, dt &= - \frac{B_{n + 1}^-}{n} \left( f^{(n)} \left( b \right) - f^{(n)} \left( a \right) \right) - \frac{1}{n} \int_a^b B_{n + 1}^- \left( \{ t \} \right) f^{(n + 1)} (t) \, dt \end{align*} Using this, we will prove by induction that \begin{align*} \sum_{a < k \le b} f(k) &= \int_a^b f(t) \, dt - \frac{(-1)^n}{n!} \int_a^b B_{n + 1}^-\left( \{ t \} \right) f^{(n + 1)} (t) \, dt + \frac{1}{2} \left( f(b) - f(a) \right) - \sum_{k = 1}^n \frac{B_k^-}{k!} \left( f^{(k - 1)} (b) - f^{(k - 1)} (a) \right) \end{align*} The case for $n = 1$ is the standard Euler summation formula. Supposing that it holds for some $n$, we can aply the above integration by parts result to obtain \begin{align*} \sum_{a < k \le b} f(k) &= \int_a^b f(t) \, dt + \frac{(-1)^n}{n!} \int_a^b B_{n + 1}^-\left( \{ t \} \right) f^{(n + 1)} (t) \, dt - \sum_{k = 1}^n \frac{B_k^-}{k!} \left( f^{(k - 1)} (b) - f^{(k - 1)} (a) \right) \\ &= \int_a^b f(t) \, dt + \frac{(-1)^n}{n!} \left( - \frac{B_{n + 2}^-}{n + 1} \left( f^{(n + 1)} \left( b \right) - f^{(n + 1)} \left( a \right) \right) - \frac{1}{n + 1} \int_a^b B_{n + 2}^- \left( \{ t \} \right) f^{(n + 2)} (t) \, dt \right) \\ &\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,- \sum_{k = 1}^n \frac{B_k^-}{k!} \left( f^{(k - 1)} (b) - f^{(k - 1)} (a) \right) \\ \end{align*}